﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNQXYJ.Model;
using HNQXYJ.BLL;
namespace HNQXYJ.HN_City
{
    public partial class AddCity : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void reset_Click(object sender, ImageClickEventArgs e)
        {
            this.txtCityName.Text = "";
            this.txtCityCode.Text = "";
            this.txtLng.Text = "";
            this.txtLat.Text = "";
        }

        protected void add_Click(object sender, ImageClickEventArgs e)
        {
            HCity city = new HCity();
            city.Name = this.txtCityName.Text.Trim();
            city.ParentCode = "henansheng";
            city.SelfCode = this.txtCityCode.Text.Trim();
            city.DateAdd = DateTime.Now;
            city.Lng = Convert.ToDouble( this.txtLng.Text.Trim());
            city.Lat = Convert.ToDouble(this.txtLat.Text.Trim());

            int res = new CityBLL().AddCity(city);
            if (res > 0)
            {
                Response.Redirect("CityMgr.aspx");
            }
            else
            {
                this.Label1.Text = "添加失败";
            }
        }
    }
}